package cn.edu.hnnu.c.rentacar.rentrecorddao.text;

import cn.edu.hnnu.c.rentacar.beans.RentRecord;
import cn.edu.hnnu.c.rentacar.dao.hibernateimpl.RentRecordDAOHibernateImpl;
import cn.edu.hnnu.c.rentacar.idao.IRentRecordDAO;

public class TextRentRecordDAO {

	private static IRentRecordDAO dao = RentRecordDAOHibernateImpl.getInstace();
	/**
	 * @param args
	 */
	public static void main(String[] args) {
//		addRentRecord();
//		getRentRecords();
//		getRentRecord();
//		upDateRecord();
//		deleteRecord();
		
	}
	
	public static void addRentRecord(){
		RentRecord rentRecord = new RentRecord();
		rentRecord.setCarId(1);
		rentRecord.setCustomerId(1);
		rentRecord.setUserId(1);
		dao.addRentRecord(rentRecord);
	}
	
	/**
	 *
	 */
	public static void getRentRecords(){
		System.out.println(dao.getAllRentRecords());
	}
	
	public static void getRentRecord(){
		System.out.println(dao.getRentRecordById(1));
	}
	
	public static void upDateRecord(){
		RentRecord record = new RentRecord();
		record.setRentRecordId(3);
		record.setCarId(100);
		System.out.println(dao.updateRentRecord(record));
	}
	
	public static void deleteRecord(){
		System.out.println(dao.deleteRentRecordById(3));
	}

}
